/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.vladimirkolarevic.eventplanner.beans;

import com.vladimirkolarevic.eventplanner.Event;
import com.vladimirkolarevic.eventplanner.User;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

import org.hibernate.annotations.NaturalId;

/**
 *
 * @author Vlada
 */
@Entity
public class UserBean implements User,Serializable{

   
    @Id
    @GeneratedValue
    private Long id;
    
    @Basic(optional=false)
    @NaturalId
    private String username;
    
    @Basic(optional=false)
    private String password;
    
    @Basic(optional=false)
    private String firstName;
    
    @Basic(optional=false)
    private String secondName;
    
    @Basic(optional=false)
    private String email;
    
    
    @OneToMany(targetEntity=EventBean.class,cascade=CascadeType.ALL)
    private List<Event> events=new LinkedList<Event>();

    public UserBean() {
		
	}
    
    public void setUserName(String userName) {
        this.username=userName;
    }

    public String getUserName() {
       return username;
    }

    public void setPassword(String password) {
        this.password=password;
    }

    public String getPassword() {
        return password;
    }

    public void setFirstName(String firstName) {
        this.firstName=firstName;
    }

    public String getFirstName() {
       return firstName;
    }

    public void setSecondName(String secondName) {
        this.secondName=secondName;
    }

    public String getSecondName() {
        return secondName;
    }

    public void setEmail(String email) {
        this.email=email;
    }

    public String getEmail() {
        return email;
    }

    

    public Long getId() {
        return id;
    }


	public List<Event> getEvents() {
		// TODO Auto-generated method stub
		return events;
	}

	public void setEvents(List<Event> events) {
		// TODO Auto-generated method stub
		this.events=events;
	}

	public void addEvents(Event event) {
		
		events.add(event);
		
	}

	



}
